package com.ls.pattern.composite.complextree;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 树节点
 *
 * @author 挥之以墨
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DeptNode {

    private List<DeptNode> children = new ArrayList<>();

    private Integer id;
    private Integer parentId;
    private String name;
    private Integer level;
    private String path;

    public void showName() {
        System.out.println(this.name);
        for (DeptNode deptNode : this.children) {
            for (int i = 0; i < level; i++) {
                System.out.print("   ");
            }
            System.out.print("+-");
            deptNode.showName();
        }
    }

}
